<style>.footer.footer-home {display: none;}
#toTop{position: fixed;
    height: 45px;
    width: 45px;
    right: 15px;
    bottom: 90px;}
</style>
<div class="header">
    <a href="javascript:history.go(-1); " class="return iconfont icon-shangyiye"></a>
    <div class="header-title"></div>
</div>
<div class="header">
    <form action="index.php">
        <i class="iconfont icon-sousuo"></i>
        <input type="hidden" name="act" value="index">
        <input type="hidden" name="op" value="search">
        <input type="text" name="title" placeholder="输入要搜索的内容" value="<?php echo $output['search']['title']; ?>" />
    </form>
   <!-- <div class="location"><a href="index.php?act=location"><span><?php /*echo $_SESSION['pos']['city_name']; */?></span><i class="iconfont icon-xia"></i></a></div>-->
</div>
<div class="content content-hot">
    <div class="commodity">
        <ul>
            <?php if (!empty($output['tickets'])): ?>
            <?php foreach ($output['tickets'] as $ticket): ?>
            <a href="index.php?act=ticket&op=detail&tid=<?php echo $ticket['tk_id']; ?>">
            <li>
                <div class="commodity-img">
                    <img src="<?php echo $ticket['tk_thumb']; ?>" />
                </div>
                <div class="commodity-con">
                    <div class="commodity-title"><?php echo $ticket['tk_title']; ?></div>
                    <div class="commodity-brief"><?php echo $ticket['tk_subtitle']; ?></div>
                    <div class="commodity-grade">
                        <i class="iconfont icon-xing"></i>
                        <i class="iconfont icon-xing"></i>
                        <i class="iconfont icon-xing"></i>
                        <i class="iconfont icon-xing"></i>
                        <i class="iconfont icon-xing"></i>
                    </div>
                    <div class="commodity-price">
                        <?php list($int, $float) = explode('.',$ticket['tk_show_price']); ?>

                        <?php if ($ticket['tk_cate1'] == 2): ?>
                        <b><samp>¥</samp><?php echo $int; ?>.<samp><?php echo $float; ?><label>人均消费</label></samp></b>
                        <?php elseif ($ticket['tk_cate2'] == 10): ?>
                        <b><samp>免费畅游</samp></b>
                        <?php else: ?>
                        <b><samp>¥</samp><?php echo $int; ?>.<samp><?php echo $float; ?></samp></b><del>¥<?php echo $ticket['tk_market_price']; ?></del>
                        <?php endif; ?>

                        <div class="commodity-location"><?php echo $ticket['tk_city_name']; ?></div>
                    </div>
                </div>
                <div class="clear"></div>
            </li>
            </a>
            <?php endforeach; ?>
            <?php else: ?>
            <div class="empty">搜索不到您要的内容</div>
            <?php endif; ?>
        </ul>
    </div>
    <div id="toTop" style="display: none;"><img src="resource/images/anniu.png"></div>
    <div class="load hide">正在加载...</div>
</div>

<script>
    var allNum = <?php echo $output['TotalNum']; ?>,
        allPage = <?php echo $output['TotalPage']; ?>,
        curPage = 1;

    var is_scroll = false;
    //ajax加载数据
    function loadpage() {
        if(!is_scroll){
            return;
        }
        if (curPage < allPage) {
            curPage += 1;
        } else {
            $('.load').text('没有更多内容了').show();
            return;
        }
        $.get(location.href, {isajax:1,curpage:curPage},function(data){
            if(data){
                $(".commodity > ul").append(data);
                $('.load').hide();
            }
        });
    }
    $(window).scroll(function () {
        $('.load').show();
        is_scroll = true;
        //已经滚动到上面的页面高度
        var scrollTop = $(this).scrollTop();
        //页面高度
        var scrollHeight = $(document).height();
        //浏览器窗口高度
        var windowHeight = $(this).height();
        //此处是滚动条到底部时候触发的事件，在这里写要加载的数据，或者是拉动滚动条的操作
        if (scrollTop + windowHeight == scrollHeight) {
            loadpage();
        }
    });

$(function(){


    //显示或隐藏回到顶部按钮
    $(document).scroll(function() { //滚动条事件
        var scrTop = $(document).scrollTop();
        if(scrTop > 380) {
            $("#toTop").fadeIn();
        } else {
            $("#toTop").fadeOut();
        }
    })
    //回到顶部
    $("#toTop").click(function() {
        $('body').animate({
            scrollTop: '0px'
        }, 800);
    });

})
</script>